package com.zysd.collection.scheduler.entity;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.List;

/**
 * 集中器信息
 *
 * @author liuht
 */
public class Terminal {

    public Terminal() {

    }

    public Terminal(Integer regionNo, Integer localNo) {
        this.regionNo = regionNo;
        this.localNo = localNo;
    }

    public Terminal(Integer regionNo, Integer localNo, String ipAddr, Integer ipPort) {
        this.regionNo = regionNo;
        this.localNo = localNo;
        this.ipAddr = ipAddr;
        this.ipPort = ipPort;
    }


    /**
     * <pre>
     * 终端表主键
     * 表字段 : esm_terminal.id
     * </pre>
     */
    private Long id;

    /**
     * <pre>
     * 终端名称
     * 表字段 : esm_terminal.name
     * </pre>
     */
    private String name;

    /**
     * <pre>
     * 区域码
     * 表字段 : esm_terminal.regionNo
     * </pre>
     */
    private Integer regionNo;

    /**
     * <pre>
     * 地址码
     * 表字段 : esm_terminal.localNo
     * </pre>
     */
    private Integer localNo;

    /**
     * <pre>
     * 终端类型
     * 表字段 : esm_terminal.termType
     * </pre>
     */
    private String termType;

    /**
     * <pre>
     * 通讯规约
     * 表字段 : esm_terminal.protocol
     * </pre>
     */
    private String protocol;


    /**
     * <pre>
     * 前置机IP地址
     * 表字段 : esm_terminal.ipAddr
     * </pre>
     */
    private String ipAddr;

    /**
     * <pre>
     * 前置机IP端口
     * 表字段 : esm_terminal.ipPort
     * </pre>
     */
    private Integer ipPort;

    /**
     * <pre>
     * 终端型号
     * 表字段 : esm_terminal.terminalType
     * </pre>
     */
    private String terminalType;

    private Integer pn;

    /**
     * 测量点集合
     */
    private List<Integer> pns;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getRegionNo() {
        return regionNo;
    }

    public void setRegionNo(Integer regionNo) {
        this.regionNo = regionNo;
    }

    public Integer getLocalNo() {
        return localNo;
    }

    public void setLocalNo(Integer localNo) {
        this.localNo = localNo;
    }

    public String getTermType() {
        return termType;
    }

    public void setTermType(String termType) {
        this.termType = termType;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public void setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
    }

    public Integer getIpPort() {
        return ipPort;
    }

    public void setIpPort(Integer ipPort) {
        this.ipPort = ipPort;
    }

    public String getTerminalType() {
        return terminalType;
    }

    public void setTerminalType(String terminalType) {
        this.terminalType = terminalType;
    }

    public Integer getPn() {
        return pn;
    }

    public void setPn(Integer pn) {
        this.pn = pn;
    }

    public List<Integer> getPns() {
        return pns;
    }

    public void setPns(List<Integer> pns) {
        this.pns = pns;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        Terminal that = (Terminal) o;

        return new EqualsBuilder()
                .append(id, that.id)
                .append(name, that.name)
                .append(regionNo, that.regionNo)
                .append(localNo, that.localNo)
                .append(termType, that.termType)
                .append(protocol, that.protocol)
                .append(ipAddr, that.ipAddr)
                .append(ipPort, that.ipPort)
                .append(terminalType, that.terminalType)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(name)
                .append(regionNo)
                .append(localNo)
                .append(termType)
                .append(protocol)
                .append(ipAddr)
                .append(ipPort)
                .append(terminalType)
                .toHashCode();
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("name", name)
                .append("regionNo", regionNo)
                .append("localNo", localNo)
                .append("termType", termType)
                .append("protocol", protocol)
                .append("ipAddr", ipAddr)
                .append("ipPort", ipPort)
                .append("terminalType", terminalType)
                .toString();
    }
}
